package com.bbs.util;

import java.io.Serializable;

public class Result<T> implements Serializable {
    //serialVersionUID 是 Java 中用于序列化的版本号
    //当一个对象被序列化后，其版本号将会被记录下来
    //当对象被反序列化时，反序列化器将会检查对象的版本号是否与当前类的版本号一致，如果不一致，那么反序列化器将会抛出一个 InvalidClassException 异常
    private static final long serialVersionUID = 1L;
    private int resultCode;
    private String message;
    private T data;

    public Result() {
    }

    public Result(int resultCode, String message) {
        this.resultCode = resultCode;
        this.message = message;
    }

    public int getResultCode() {
        return resultCode;
    }

    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Result{" +
                "resultCode=" + resultCode +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
